﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DispatchAssist.Model;

namespace DispatchAssist.BusinessLogical.Model
{
    public class AlertAllInfo
    {
        /// <summary>
        /// 唯一标识
        /// </summary>
        public Guid AlertID { get; set; }

        /// <summary>
        /// 对应的气象预警报文唯一标识
        /// </summary>
        public Guid MetroMsgID { get; set; }

        /// <summary>
        /// 对应的航班动态唯一标识
        /// </summary>
        public string FlightInfoID { get; set; }

        /// <summary>
        /// 告警机场关系，如：计划降落场、起飞备降场
        /// </summary>
        public string AirportRelation { get; set; }

        /// <summary>
        /// 预警时间
        /// </summary>
        public DateTime AlertTime { get; set; }

        /// <summary>
        /// 告警行为位叠加
        /// </summary>
        public int AlertActionFlag { get; set; }

        /// <summary>
        /// 已执行告警行为位叠加
        /// </summary>
        public int PerformActionFlag { get; set; }

        /// <summary>
        /// 告警席位ID
        /// </summary>
        public Guid SeatID { get; set; }

        // <summary>
        /// 承运人
        /// </summary>
        public string Carrier { get; set; }

        /// <summary>
        /// 航班号
        /// </summary>
        public string FlightNo { get; set; }

        /// <summary>
        /// 飞机尾号
        /// </summary>
        public string TailNo { get; set; }

        /// <summary>
        /// 起始站
        /// </summary>
        public string DeptAirport { get; set; }

        /// <summary>
        /// 到达站
        /// </summary>
        public string ArrAirport { get; set; }

        /// <summary>
        /// 计划起飞时间
        /// </summary>
        public DateTime PlanDeptTime { get; set; }

        /// <summary>
        /// 计划到达时间
        /// </summary>
        public DateTime PlanArrTime { get; set; }

        /// <summary>
        /// 预计起飞时间
        /// </summary>
        public DateTime? EstDeptTime { get; set; }

        /// <summary>
        /// 预计到达时间
        /// </summary>
        public DateTime? EstArrTime { get; set; }

        /// <summary>
        /// 实际起飞时间
        /// </summary>
        public DateTime? RealDeptTime { get; set; }

        /// <summary>
        /// 实际到达时间
        /// </summary>
        public DateTime? RealArrTime { get; set; }

        /// <summary>
        /// 起飞备降场
        /// </summary>
        public string DeptBackup { get; set; }

        /// <summary>
        /// 到达备降场
        /// </summary>
        public string ArrBackup { get; set; }

        /// <summary>
        /// 航路备降场（集合）
        /// </summary>
        public string RouteBackup { get; set; }

        /// <summary>
        /// 预警机场
        /// </summary>
        public string Airport { get; set; }

        /// <summary>
        /// 预警时间
        /// </summary>
        public DateTime WarnTime { get; set; }

        /// <summary>
        /// 预警级别
        /// </summary>
        public int WarnLevel { get; set; }

        /// <summary>
        /// 预警原始报文
        /// </summary>
        public string WarnMsg { get; set; }

        /// <summary>
        /// 中文气象预警信息
        /// </summary>
        public string WarnInfo { get; set; }

        /// <summary>
        /// 预警报文名称
        /// </summary>
        public string FileName { get; set; }

        /// <summary>
        /// 预警报文文件创建时间
        /// </summary>
        public DateTime FileCreateTime { get; set; }

        /// <summary>
        /// 报文文件下载时间
        /// </summary>
        public DateTime FileDownloadTime { get; set; }

        /// <summary>
        /// 报警生成时间
        /// </summary>
        public DateTime? AlertCreateTime { get; set; }

        /// <summary>
        /// 预警信息状态
        /// </summary>
        public int MsgStatus { get; set; }

        /// <summary>
        /// 机场名
        /// </summary>
        public string AirportFullName { get; set; }

        public string MAC { get; set; }

        public string SeatName { get; set; }

        /// <summary>
        /// 等级名称
        /// </summary>
        public string WarnLevelName
        {
            get
            {
                switch (WarnLevel)
                {
                    case 1:
                        return "红色预警";
                    case 2:
                        return "黄色预警";
                    case 3:
                        return "蓝色预警";
                    default:
                        return "";
                }

            }
        }

        public NormalAlertInfo ClientModelInfo
        {
            get
            {
                NormalAlertInfo model = new NormalAlertInfo();

                model.Airport = this.Airport;
                model.AirportFullName = this.AirportFullName;
                model.AirportRelation = this.AirportRelation;
                model.AlertActionFlag = this.AlertActionFlag;
                model.AlertID = this.AlertID;
                model.ArrAirport = this.ArrAirport;
                model.Carrier = this.Carrier;
                model.DeptAirport = this.DeptAirport;
                model.EstArrTime = this.EstArrTime;
                model.EstDeptTime = this.EstDeptTime;
                model.FlightNo = this.FlightNo;
                model.MAC = this.MAC;
                model.PerformActionFlag = this.PerformActionFlag;
                model.PlanArrTime = this.PlanArrTime;
                model.PlanDeptTime = this.PlanDeptTime;
                model.RealArrTime = this.RealArrTime;
                model.RealDeptTime = this.RealDeptTime;
                model.SeatID = this.SeatID;
                model.SeatName = this.SeatName;
                model.TailNo = this.TailNo;
                model.WarnInfo = this.WarnInfo;
                model.WarnLevel = this.WarnLevel;
                model.WarnMsg = this.WarnMsg;
                model.WarnTime = this.WarnTime;

                return model;
            }
        }


        public override string ToString()
        {
            return string.Format("[承运人：{0},航班号：{1},飞机尾号：{2},起始站：{3},到达站：{4},机场名：{5},等级名称：{6}]", Carrier, FlightNo, TailNo, DeptAirport, ArrAirport, AirportFullName, WarnLevelName);
        }

    }
}
